/**
 * 
 */
package fr.fermeManager.application.views.models;

import java.util.List;

import javax.swing.DefaultBoundedRangeModel;

import fr.fermeManager.library.model.beans.Transaction;

/**
 * @author Mo
 *
 */
public class ModelSlider extends DefaultBoundedRangeModel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public ModelSlider(List<Transaction> listeTransactions, boolean maxSlider) {
		super();
		float maxValue = listeTransactions.get(listeTransactions.size()-1).getMontant();;
		float minValue = maxValue;
		
		for (int i = 0; i < listeTransactions.size()-1; i++) {
			if(listeTransactions.get(i).getMontant() > maxValue){
				maxValue = listeTransactions.get(i).getMontant();
			}
			if(listeTransactions.get(i).getMontant() < minValue){
				maxValue = listeTransactions.get(i).getMontant();
			}
		}
		
		setMaximum(new Float(maxValue).intValue());
		setMinimum(new Float(minValue).intValue());
		
		System.out.println("MAX :"+maxValue);
		System.out.println("MIN :"+maxValue);
	}

	
	
}
